from .base import *
from .question import *
from .answer import *
from .comment import *
from .weibo import *
from .news import *
from .post import *
from .dianping import *
from .user import *
from .column import *
from .video import *
from .mock import *
from .seed import *
from .trace import  *
from .electronic_business import *

detail_items = [
    QuestionItem, # 问题
    AnswerItem,   # 回答
    CommentItem,  # 评论
    WeiboItem,    # 微博
    NewsItem,     # 新闻
    PostItem,     # 帖子
    DianPingItem, # 点评
    UserItem,     # 用户
    ColumnItem,   # 版块
    VideoItem     # 视频
]

def es_to_detail_item(source):
    for detail_item in detail_items:
        if source['type'] == detail_item.item_type:
            item = detail_item.es_to_item(source, detail_item)
            item['content'] = source.get('pcontent', '')
            item['porigin'] = source.get('origin', {})
            item['porigin']['createTime'] = source.get('createTime')
            item['origin'] = None
            return item